function Echart2(xData,yData,name,ledgercolor,unit,isClear){
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(name));	
    option = {
        title : {
            text: unit,
            x:'left',
            textStyle: {//主标题文本样式{"fontSize": 18,"fontWeight": "bolder","color": "#333"}
                fontSize: 12,
                color:'#fff'
                },             
        },
        tooltip: {//鼠标指上时的标线
            trigger: 'axis',
            axisPointer: {
                lineStyle: {
                    color: '#fff'
                }
            }
        },
        grid: {
            y: '15%',
            right: '5%',
            left:'13%',
            bottom:'16%',
        },
        xAxis: [{    	
            type: 'category',
            boundaryGap: false,
            axisLine: {
                lineStyle: {
                    color: 'rgba(0,84,134,1)'
                }
            },
            axisLabel: {
                textStyle: {
                    color:'#fff',
                },
            },
            axisTick:{       //y轴刻度线
                show:false
            },                
            data: xData
        }],
        yAxis: [{
            type: 'value',
            axisTick: {
                show: false
            },
            axisLine: {
                show:false,
                lineStyle: {
                    color: 'rgba(0,84,134,1)'
                }
            },
            axisLabel: {
                margin: 10,
                textStyle: {
                    fontSize: 14
                },
                textStyle: {
                    color:'#fff',
                },
            },
            splitLine: {
                lineStyle: {
                    color: 'rgba(0,84,134,1)'
                }
            }
        }],
        series: [{
            name: '',
            type: 'line',
            smooth: true,
            symbol: 'circle',
            symbolSize: 12,
            lineStyle: {
                normal: {
                    width: 2,
                    color:ledgercolor,
                }
            },
            areaStyle: {
                normal: {
                    color: '#0d71e5',
                    shadowColor: 'rgba(0, 0, 0, 0.1)',
                    shadowBlur: 10
                }
            },
            itemStyle: {
                normal: {
                   color: '#ffdc34', //改变折线点的颜色
                }
            },
            data: yData,       
        }]
    };
    // 使用刚指定的配置项和数据显示图表。
    if(isClear) myChart.clear()
    myChart.setOption(option);
    window.addEventListener("resize", function() {
        myChart.resize();
    });
}

function Echart3(xData,yData,name,ledgercolor,unit,isClear){
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(name));	
    option = {
        legend: {
            show:true,
            icon: 'circle',
            itemWidth: 10,
            itemHeight: 10,
            itemGap: 15,
            data: [unit],
            right: '10px',
            top: '0px',
            textStyle: {
                fontSize: 14,
                color: '#fff'
            }
        },
        tooltip: {//鼠标指上时的标线
            trigger: 'axis',
            axisPointer: {
                lineStyle: {
                    color: '#fff'
                }
            }
        },
        grid: {
            y: '10%',
            right: '7%',
            left:'14%',
            bottom:'14%',
        },
        xAxis: [{    	
            type: 'category',
            boundaryGap: false,
            axisLine: {
                lineStyle: {
                    color: 'rgba(20, 131, 83, 1)'
                }
            },
            axisLabel: {
                textStyle: {
                    color:'#fff',
                    fontSize: 14
                },
            },
            axisTick:{       //y轴刻度线
                show:false
            },                
            data: xData
        }],
        yAxis: [{
            type: 'value',
            axisTick: {
                show: false
            },
            axisLine: {
                show:false,
                lineStyle: {
                //TODO：改这里。
                    color: '#fff'
                }
            },
            axisLabel: {
                margin: 10,
                textStyle: {
                    fontSize: 14
                },
                textStyle: {
                    color:'#fff',
                    fontSize: 14
                },
            },
            splitLine: {
                lineStyle: {
                    color: '#1e3e49'
                }
            }
        }],
        series: [{
            name: '单位/笔',
            type: 'line',
            smooth: true,
            areaStyle: {
                normal: {
                    color: 'rgba(20, 131, 83, 1)'
                }
            },
            lineStyle: {
                normal: {
                    width: 2,
                    color:'rgba(64, 250, 128, 1)',
                }
            },
            itemStyle: {
               normal: {
                  color: 'rgba(64, 250, 128, 1)', //改变折线点的颜色
               }
           },
            data: yData,       
        }]
    };
    //Android.getJson('测试：',jsonData.ledgercolor)
    // 使用刚指定的配置项和数据显示图表。
    if(isClear) myChart.clear()
    myChart.setOption(option);
    window.addEventListener("resize", function() {
        myChart.resize();
    });
}      

function Echart5(mesTitle,name,ledgerData,colors,isClear){
    var myChart = echarts.init(document.getElementById(name))
    option = {
        legend: {
            show:true,
            icon: 'circle',
            itemWidth: 12,
            itemHeight: 12,
            itemGap: 110,
            data: ['会员','非会员'],
            // right: '10px',
            // top: '0px',
            textStyle: {
                fontWeight: "bold",//加粗
                fontSize: 12,
                color: '#fff'
            }
        },            
        color: colors,
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        grid: {
            left:'15%',
            right:'15%',
            bottom:'16%',
        },
        calculable : true,
        series : [
            {
                name:mesTitle,
                type:'pie',
                radius : [0, '50%'],
                data:ledgerData,
                label: {
                    normal: {
                        formatter: '{b|{b} ({d}%)}',
                        alignTo: 'labelLine',
                        rich: {
                            b: {
                                fontSize: 8,
                                align: 'left',
                                padding: 8
                            },
                            d: {
                                fontSize: 8,
                                align: 'center',
                                padding: 4,
                            }
                        },
                    }
                },
                itemStyle: { 
                    normal: {
                        borderWidth: 2,
                        borderColor:'#042B5B',        
                    }
                },		        
            }
        ]
    };
    if(isClear) myChart.clear()
    myChart.setOption(option);
    window.addEventListener("resize", function() {
        myChart.resize();
    });		
}    

function Echart7(echartName,xData,yData1,unit,isClear,color){
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(echartName));	
    var option = {
        title : {
        //TOP  6
            text:'',
            x:'right',
            textStyle: {//主标题文本样式{"fontSize": 18,"fontWeight": "bolder","color": "#333"}
                fontSize: 7,
                color:'#E4FF00'
                },             
        },            
        grid: {
            bottom:'20%',
            top: '15%',
            left: '8%',
            right: '0%'
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        legend: {
            show:true,
            icon: 'circle',
            itemWidth: 6,
            itemHeight: 5,
            itemGap: 8,
            data: [unit],
            right:'0',
            top: '5%',
            textStyle: {
                fontSize: 5,
                color: '#fff'
            }
        },
        calculable: true,
        xAxis: [
            {
                type: 'category',            
                axisTick: {show: false},
                data: xData,           
                //设置坐标轴字体颜色和宽度			
                axisLine: {
                    show:false,
                    lineStyle: {
                        color: '#00B4FF'
                    }
                },
                axisLabel: {
                    interval: 0,
                    rotate:20  ,
                    fontWeight: "bold",//加粗
                    textStyle: {
                        color:'#fff',
                        lineHeight:1,
                        fontSize: 9
                    }
                }
            }
        ],
        yAxis: [
            {
                splitLine:{show: false},//去除网格线
                axisTick: { show: false }, //y轴刻度
                type: 'value',
                //设置坐标轴字体颜色和宽度
                axisLine: {
                    show:false,
                    lineStyle: {
                        color: '#5D4AF4'
                    }
                },
                axisLabel: {
                    show:false,
                    textStyle: {
                        color:'#fff',
                    }
                }
            }
        ],
        series: [
            {
                name: '交易数/笔',
                type: 'bar',
                barWidth:12,
                barGap: 0,
                data: yData1,
                //配置样式
                itemStyle: {  
                    //通常情况下：
                    normal:{  
                        barBorderRadius:8
                    }
                },		            
                color:function(params){
                    var item1 = new echarts.graphic.LinearGradient(
                        0, 0, 0, 1,
                        [
                            {offset: 0, color: color},
                            {offset: 1, color: color}
                        ]
                    );
                    return item1;
//      			var colorList = [item1];
//      			return colorList[params.dataIndex]
                },
                label: {
                    normal: {
                        show: true,
                        position: 'top',
                        color:'#E4FF00',
                        fontWeight: "bold",//加粗
                        fontSize:9
                    }
                }
            }
        ]
    };
    // 使用刚指定的配置项和数据显示图表。
    if(isClear) myChart.clear()
    myChart.setOption(option);	        
    window.addEventListener("resize", function() {
        myChart.resize();
    });			
}

function heEchart(echartName,xData,yData,colorItems,unit,isClear){
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(echartName));					
    option = {	
        title : {
            text:unit,
            x:'right',
            textStyle: {//主标题文本样式{"fontSize": 18,"fontWeight": "bolder","color": "#333"}
                fontSize: 6,
                color:'#fff'
                },             
        },

        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow'
            }
        },
        grid: {
            top: '0%',
            left: '18%',
            right: '10%',
            bottom: '12%'
        },
        xAxis: {
            splitLine:{
                show: true, //false去除网格线
                lineStyle:{
                color: 'rgba(25, 186, 139, .17)',
                width: 1,
                type: 'solid'
                }					    		
            },
            type: 'value',
            axisTick: { show: false }, //y轴刻度
            boundaryGap: [0, 0.01],
            //设置坐标轴字体颜色和宽度
            axisLine: {
                show:true,
                lineStyle: {
                 color: "rgba(25, 186, 139, .17)",
                }
            },
            axisLabel:{
                show:true,
                color: "#fff",
                //rotate: 20,
                fontWeight: "bold",//加粗
                textStyle: {
                    fontSize: 10,
                    color: '#fff'
                }
            }			        
        },
        yAxis: {
            type: 'category',
            axisTick: { show: false }, //y轴刻度
            data: yData,
            //设置坐标轴字体颜色和宽度
            axisLine: {
                show:false,
                lineStyle: {
                  color: "#fff",
                }
            },
            axisLabel:{
                show:true,
                interval: 0,
                color: "#fff",
                fontWeight: "bold",//加粗
                textStyle: {
                    fontSize: 10,
                    color: '#fff'
                }
            }
        },
        series: [
            {
                name: '数量',
                type: 'bar',
                barWidth: 10,
                data: xData,
                //配置样式
                itemStyle: {  
                    //通常情况下：
                    normal:{  
                    ////每个柱子的颜色即为colorList数组里的每一项，如果柱子数目多于colorList的长度，则柱子颜色循环使用该数组
                        color: function (params){
                            var colorList = colorItems;
                            return colorList[params.dataIndex];
//	                        return colorList;
                        },
                        barBorderRadius:8
                    },
                    //鼠标悬停时：
                    emphasis: {
                        shadowBlur: 8,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'

                    }
                }
            }
        ]
    };	
    // 使用刚指定的配置项和数据显示图表。
    if(isClear) myChart.clear()
    myChart.setOption(option);	
    window.addEventListener("resize", function() {
        myChart.resize();
    });			 
}
